//
//  UIView+RoundRect.m
//  smartagent
//
//  Created by apple on 30/10/2017.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "UIView+RoundRect.h"

@implementation UIView (RoundRect)

- (void)roundRectWithRadius:(CGFloat)radius{
    self.layer.cornerRadius = radius;
    self.layer.masksToBounds = YES;
}

- (void)roundRectWithRadius:(CGFloat)radius corners:(UIRectCorner)corners{
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds      byRoundingCorners:corners    cornerRadii:CGSizeMake(radius,radius)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = self.bounds;
    maskLayer.path = maskPath.CGPath;
    self.layer.mask = maskLayer;
}

@end
